package com.vcredit.creditcat.web.app;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.dubbo.config.annotation.Reference;
import com.vcredit.creditcat.api.ICreditCardProcessManager;
import com.vcredit.creditcat.dto.creditcard.ValidCreditCardParam;
import com.vcredit.creditcat.model.Cust;
import com.vcredit.creditcat.vo.JsonResult;
import com.vcredit.framework.annotation.Log;

/**
 * 信用卡
 * @author zhaoqi01
 *
 */
@RestController
@RequestMapping(value = "/creditCard")
public class CreditCardProcessController extends BaseCreditCatController {

	@Reference(version = "1.0")
	private ICreditCardProcessManager creditCardProcessManager;

	/**
	 * 绑定信用卡
	 * @author zhaoqi01
	 * @param param
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@Log
	@RequestMapping(value = "/validateCard")
	@SuppressWarnings("rawtypes")
	public JsonResult validateCard(@RequestBody ValidCreditCardParam param, HttpServletRequest request)
			throws Exception {
		Cust cust = super.getCust(request);
		creditCardProcessManager.validCreditCard(cust, param.getBankCode(), param.getBankCardNo());
		return JsonResult.SuccessResponse(null);
	}
}
